package com.zyh.loop;

import java.util.Scanner;

public class LoopDemo1 {
    public static void main(String[] args) {
        System.out.println("请输入一个[0,9]整数：");
        int num = new Scanner(System.in).nextInt();
//        判断合法性
        if (num < 0 || num > 9) {
            System.err.println("输入有误！");
            return;
        }
//        数据合法时
        int sum = 0, bit = 0;
        for (int i = 0; i < 5; i++) {
            bit = (int) (num * Math.pow(10, i) + bit);
            sum = sum + bit;
        }
        System.out.println("sum = " + sum);
    }
}
